# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#文件：postAppsvr.py
触发Appsvr征信报告H5的接口
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


import requests

from interfacetest.baseset.appsvr_api import API_APPSVR
from pycacho.cachobase.logger import Logger

logger = Logger("appsvr").get_log()


url = 'https://test.zxtouch.msxiaodai.com'

headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36',
            'content-Type': 'application/json'
        }


def submission(n):
    fu_url = url + '/data/submission'
    data = API_APPSVR['submission']
    data['account'] = '13000000' + str(n)
    req1 = requests.post(fu_url, json=data, headers=headers)
    data = req1.text
    logger.info("金融产品及信息类别提交接口响应信息：%s", data)


def userInfo():
    fu_url = url + '/app/userInfo'
    data = API_APPSVR['submission']
    data['usrNo'] = 'YH20190902000002'
    req1 = requests.post(fu_url, json=data, headers=headers)
    data = req1.text
    logger.info("获取用户信息查询接口响应信息：%s", data)


def commit():
    fu_url = url + '/basicInformation/commit'
    data = API_APPSVR['commit']
    data['userNo'] = 'YH20190902000002'
    req1 = requests.post(fu_url, json=data, headers=headers)
    print(data)
    data = req1.text
    logger.info("基本信息提交接口响应信息：%s", data)


def main():
    for i in range(101,150):
        submission(i)

if __name__ == '__main__':
    main()
    #submission(100)
    #userInfo()
    #commit()